'''
Created on Feb 22, 2014

@author: yfrank
'''

class Point(object):
    '''
    classdocs
    '''
    def __init__(self,x,y):
        self.x = x
        self.y = y

    def x(self):
        return self.x
    def y(self):
        return self.y

    def __str__(self):
        return str(self.x)+" "+str(self.y)


class ReferencePoint(Point):
    '''
    classdocs
    '''
    def __init__(self, x,y,a):

        super(ReferencePoint,self).__init__(x,y)
        self.angle = a

    def angle(self):
        return self.angle



class Polygon(object):
    '''
    classdocs
    '''
    def __init__(self, vertices):
        self.vertices = vertices

    def __str__(self):
        ret = str(len(self.vertices))
        for p in self.vertices:
            ret += "\n"+str(p)
        return ret


class Robot(Polygon):
    '''
    classdocs
    '''
    def __init__(self, vertices,ref=0):
        super(Robot,self).__init__(vertices)
        self.ref_point = ref


def parse_robots(filename):
    robots = []
    f = open(filename,'r')
    num_robots = int(f.readline())
    for i in range(num_robots):
        vertices = []
        num_vertices = int(f.readline())
        for i in range(num_vertices):
            xy = f.readline().split()
            x = float(xy[0])
            y = float(xy[1])
            p = Point(x,y)
            vertices.append(p)
        robot = Robot(vertices)
        robots.append(robot)
    return robots


